package com.sv.zgydor.service.impl;

import com.sv.zgydor.pojo.pg.Table1Entity;
import com.sv.zgydor.pojo.pg.Table2Entity;
import com.sv.zgydor.service.Table1Service;
import com.sv.zgydor.service.Table2Service;
import com.sv.zgydor.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * Class summary
 * User: kevin
 * Date: 2017/09/25
 * Time: 17:04
 * Description:
 */
@Service
public class TestServiceImpl implements TestService {

    @Autowired
    private Table1Service table1Service;

    @Autowired
    private Table2Service table2Service;

    @Override
    @Transactional
    public void saveTest() {
        Table1Entity t1 = new Table1Entity();
        Table2Entity t2 = new Table2Entity();

        t1.setId1(new Long(100));
        t1.setName1("第100");

        t2.setId2(new Long(200));
        t2.setName2("第200");

        table1Service.save(t1);
        table2Service.save(t2);
    }
}
